package cn.wolfcode.controller;

import cn.wolfcode.domain.Result;
import cn.wolfcode.utils.OSSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController

public class UploadController {

    @Autowired
    private OSSUtils ossUtils;

    @PostMapping("/upload")
    public Result  upload(MultipartFile image) throws IOException {
        String url = ossUtils.upload(image);
        return Result.success(url);
    }

}
